﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Escuela.Forms
{
    public partial class IngresoForm : Form
    {
        private Instituto inst;

    

        public IngresoForm(Instituto inst)
        {
            this.inst = inst;
            InitializeComponent();
        }

      

        private void btAceptar_Click(object sender, EventArgs e)
        {
            try
            {

                string observacion = textDescrip.Text.Trim();
                DateTime fecha = Convert.ToDateTime(dateTimePicker1.Text.Trim());
                if (!String.IsNullOrEmpty(maskedNroCur.Text.Trim()) && !String.IsNullOrEmpty(observacion))
                {
                    decimal monto = Convert.ToDecimal(maskedNroCur.Text.Trim());
                    this.inst.registrarIngreso(monto, fecha, observacion);
                    MessageBox.Show("Ingreso registrado correctamente");
                    this.limpiarTxt();

                }
                else
                {
                    MessageBox.Show("Complete toda la informacion solicitada");
                }
            }
            catch
            { }

        }
        private void btCancelar_Click(object sender, EventArgs e)
        {
            this.limpiarTxt();
        }

        protected void limpiarTxt()
        {
            this.textDescrip.Clear();
            this.maskedNroCur.Clear();
        }

        private void btCancelar_Click_1(object sender, EventArgs e)
        {
            
            this.limpiarTxt();
            this.Close();
        }
    }
}
